package com.secondary.util;

import java.io.File;
import java.io.IOException;

import org.apache.commons.io.FileUtils;

import com.secondary.pojos.GoodsPic;

public class MyImageUtil {
	public static void deletePic(String path, String PicName, int id, int userId) {

		try {
			File deldir = new File(path);
			File file = new File(deldir, PicName);

			file.delete();

		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public static void savePics(File[] files,String path,String [] filesFileName){
		try {
			if (files != null) {
				File savedir = new File(path);
				if (!savedir.exists())
					savedir.mkdirs();
				for (int i = 0; i < files.length; i++) {
					
					File saveFile = new File(savedir, filesFileName[i]);
					FileUtils.copyFile(files[i], saveFile);
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
}
